home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / drawse_1 / sample.ba_ / sample.ba
Encoding:
Text File  |  1998-02-07  |  994 b   |  35 lines

  1. Attribute VB_Name = "modSample"
  2. Option Explicit
  3.  
  4. Global g_dbDraw As Database
  5.  
  6. Sub Main()
  7.     Set g_dbDraw = DBEngine(0).OpenDatabase(App.Path & "\sample.mdb")
  8.     frmSample.Show
  9. End Sub
  10. Private Function ParseString(pString As String, pDelimiter As String) As String
  11.     'Purpose:
  12.     '   Parses a value from a string with a known delimiter
  13.     'Parameters:
  14.     '   pString: the string to parse from
  15.     '   pDelimiter: the delimiter used to separate parsed values
  16.     'Returns:
  17.     '   the portion of the string parsed out
  18.     'Notes:
  19.     '   pString will be reduced to remainder of string after removal
  20.     '   of parsed value and the following delimiter.
  21.  
  22.     Dim x As Integer
  23.  
  24.     x = InStr(pString, pDelimiter)
  25.     
  26.     If x > 0 Then
  27.         ParseString = Mid$(pString, 1, x - 1)
  28.         pString = Mid$(pString, x + Len(pDelimiter))
  29.     Else
  30.         'Delimiter not found in string
  31.         ParseString = pString
  32.         pString = ""
  33.     End If
  34. End Function
  35.